package com.joysuch.wwyt.edu.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.joysuch.wwyt.edu.bean.EduExamUserScopeDetailBean;
import com.joysuch.wwyt.edu.bean.EduTrainningRecordListBean;
import com.joysuch.wwyt.edu.bean.vo.ExportSignInVo;
import com.joysuch.wwyt.edu.entity.EduTrainningRecord;
import com.joysuch.wwyt.edu.entity.EduTrainningRecordUser;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

public interface EduTrainningRecordUserMapper extends BaseMapper<EduTrainningRecordUser> {

    List<EduTrainningRecordUser> selectRecordsByUserId(Long userId, Date beginTime, Date endTime);

    List<EduTrainningRecordUser> selectRecordsByDepartId(Long departId);

    List<EduTrainningRecordUser> selectRecordsByJobId(Long jobId);

    List<EduTrainningRecordUser> selectAll();

    IPage<EduTrainningRecordUser> selectRecords(Page<EduTrainningRecordUser> page, @Param("userId") Long userId, @Param("departCode") String departCode, @Param("jobId") Long jobId, @Param("beginTime") Date beginTime, @Param("endTime") Date endTime);

    List<ExportSignInVo> exportSignIn(@Param("id") Long id);


    int selectByUserAndTrainingId(@Param("currentUserId") Long currentUserId, @Param("id") Long id);

    int updateSignInStatus(@Param("currentUserId") Long currentUserId, @Param("id") Long id);

    Page<ExportSignInVo> studentStatistics(@Param("page") Page<EduTrainningRecord> page, @Param("condition") EduTrainningRecordListBean.SearchEduTrainningRecord condition,
                                           @Param("coursewareIds") List<Long> coursewareIds,
                                           @Param("coursewareCount") Integer coursewareCount,
                                           @Param("examId") Long examId);


    int updateTrainingResultByUserIds(@Param("id") Long id, @Param("trainingResult") String trainingResult, @Param("userIds") List<Long> userIds);

    List<EduTrainningRecord> queryRecordsByUserId(@Param("currentUserId") Long currentUserId);

    Integer queryRecordsByUserIdAndTrainingId(@Param("id") Long id, @Param("currentUserId") Long currentUserId);

    List<Long> selectUserLearnCourseware(@Param("currentUserId") Long currentUserId,
                                         @Param("trainingCoursewares") List<Long> trainingCoursewares,
                                         @Param("state") Integer state,
                                         @Param("trainingId") Long trainingId);


    List<EduExamUserScopeDetailBean> selectUserByTrainingId(@Param("id") Long id);

    List<EduTrainningRecordUser> selectEndUser(@Param("id") Long id);

    int selectPassExamByUserId(@Param("userId") Long userId, @Param("examId") Long examId);

    int deleteByIds(@Param("id") Long id);

    int selectExamByUserId(@Param("currentUserId") Long currentUserId,
                           @Param("examId") Long examId);

}

